<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
</head>

<body>

</body>
<script>
    // console.log(Math.random());
    console.log(parseInt(Math.random() * 10))



    // 需求：a~b
    // 0~1
    // *(b-a)
    // 0~(b-a)
    // +a
    // a~b
    // 四舍五入取整
    function random(a, b) { 
        return Math.round(Math.random() * (a - b) + b) 
    }

    console.log(random(100,10));
  

</script>

</html>